<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>第三方同步配置</title>
    <link rel="stylesheet" type="text/css" href="/cp/Public//Css/bootstrap.css" />
        <link rel="stylesheet" type="text/css" href="/cp/Public//Css/bootstrap-responsive.css" />

        
        <link rel="stylesheet" href="/cp/Public/css/public.css">
    <script type="text/javascript" src="/cp/Public//js/jquery.min.js"></script>
    <script type="text/javascript" src="/cp/Public//js/jquery.SuperSlide.js"></script>
    <script src="/cp/Public/js/common.js" type="text/javascript" charset="utf-8" async defer></script>
    <script type="text/javascript">
    function add() {

        var ret = showModalDialog("<?php echo U('config/addsyncinterface');?>", "同步接口配置", "dialogWidth:800px;dialogHeight:600px; dialogLeft:200px;dialogTop:150px;center:yes;help:yes;resizable:yes;status:yes;");
        if (ret) {
            window.location.reload();
        }

    }


    /**
     * 删除同步配置
     * @param  {[type]} id [description]
     * @return {[type]}    [description]
     */
    function deleteSyncInterface(id) {


        $.ajax({
            cache: true,
            type: "get",
            url: "<?php echo U('config/deleteSyncInterface');?>",
            data: {
                'id': id,

            }, // 你的formid
            async: false,
            error: function(request) {
                alert("Connection error");
            },
            success: function(data) {
                var status = data['status'];
                if (!status) {
                    // window.location = "<?php echo U('config/syncinterfaceconfig');?>"
                    alert('删除成功');
                    window.location.reload();
                } else {
                    alert('删除失败');
                }

            }
        });

    }
    </script>
    <style type="text/css">
    #add {
        margin: 0 auto;
    }
    </style>
</head>

<body>
    <table class="table table-bordered table-hover definewidth m10">
       
        <thead>
            <tr>
                <th>指令</th>
                <th>三方接口地址</th>
                <th>类型</th>
                <th>模拟同步</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            <?php if(is_array($data)): foreach($data as $key=>$vo): ?><tr>
                    <td><?php echo ($vo["servcode"]); ?></td>
                    <td> <?php echo ($vo["url"]); ?></td>
                    <td> <?php echo ($vo[type]?'点播':'包月'); ?></td>
                    <td><a href="<?php echo U('api/sync',array('servcode'=>$vo['servcode']));?>">模拟发送</a></td>
                    <td onclick="deleteSyncInterface('<?php echo ($vo["id"]); ?>')">删除 </td>
                </tr><?php endforeach; endif; ?>
        </tbody>
    </table>
    <div class="btn btn-primary" id="add" onclick="add()">新增</div>
</body>

</html>